<?php

namespace App\Http\Requests\Landscaping;

use Illuminate\Foundation\Http\FormRequest;
use App\Http\Requests\BaseRequest;

class ParkTaskRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'task_name' => 'required',
            'task_category_id' => 'required|integer',
            'task_content' => 'required',
            'task_address' => 'required',
            'department_id' => 'required|integer',
            'task_principal_id' => 'required|integer',
            'task_publisher_id' => 'required|integer',
            'task_plan' => 'required',
            'car_id' => 'required|integer',
            'task_begin_time' => 'required|date',
            'task_end_time' => 'required|date',
            'task_level' => 'required|integer',
            'task_source' => 'required',
            'task_status' => 'required|integer'
        ];
    }

    public function messages()
    {
        return [
            'task_name.required' => '任务名称不能为空',
            'task_category_id.required' => '任务类型不能为空',
            'task_category_id.integer' => '任务类型只能填写数字',
            'task_content.required' => '任务内容不能为空',
            'task_address.required' => '任务地址不能为空',
            'department_id.required' => '任务部门id不能为空',
            'department_id.integer' => '任务部门id只能填写数字',
            'task_principal_id.required' => '任务负责人id不能为空',
            'task_principal_id.integer' => '任务负责人id只能填写数字',
            'task_publisher_id.required' => '任务发布人id不能为空',
            'task_publisher_id.integer' => '任务发布人id只能填写数字',
            'task_plan.required' => '任务安排不能为空',
            'car_id.required' => '任务车辆id不能为空',
            'car_id.integer' => '任务车辆id只能填写数字',
            'task_begin_time.required' => '任务开始时间不能为空',
            'task_begin_time.date' => '任务开始时间格式不正确',
            'task_end_time.required' => '任务结束时间不能为空',
            'task_end_time.date' => '任务结束时间格式不正确',
            'task_level.required' => '任务紧急程度不能为空',
            'task_level.integer' => '任务紧急程度只能填写数字',
            'task_source.required' => '任务来源不能为空',
            'task_status.required' => '任务状态不能为空',
            'task_status.integer' => '任务状态只能填写数字'
        ];
    }

}
